package com.zy.web.domain;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zy.common.core.domain.BaseEntity;
import com.zy.common.xss.Xss;
import lombok.Data;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

@Data
@Entity
@Table(name = "zy_user")
@org.hibernate.annotations.Table(appliesTo = "zy_user", comment = "用户表")
@Where(clause = "deleted is null or deleted != true")
@SQLDelete(sql = "update zy_user set deleted = true where id = ? ")
public class ZyUser  extends BaseEntity {

    /**
     * 用户名
     */
    @Comment("用户名")
    @Column(name = "username")
    @Xss(message = "用户账号不能包含脚本字符")
    @NotBlank(message = "用户账号不能为空")
    @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
    private String username;

    /**
     * 密码
     */
    @TableField(
            insertStrategy = FieldStrategy.NOT_EMPTY,
            updateStrategy = FieldStrategy.NOT_EMPTY,
            whereStrategy = FieldStrategy.NOT_EMPTY
    )
    @Comment("密码")
    @Column(name = "password")
    private String password;

    /**
     * 学号
     */
    @Comment("学号")
    @Column(name = "xh")
    private String xh;

    /**
     * 联系方式
     */

    @Comment("联系方式")
    @Column(name = "lxfs")
    private String lxfs;

    /**
     * 身份
     */
    @Comment("身份")
    @Column(name = "sf")
    private String sf;

    /**
     * 项目IDS
     */
    @Comment("项目IDS")
    @Column(name = "xmIds")
    private String xmIds;
}
